<template>
  <div id="member_myself">
    <el-table
        :data="tableData"
        style="width: 100%">
      <el-table-column
          prop="username"
          label="用户名">
      </el-table-column>
      <el-table-column
          prop="nickname"
          label="昵称">
      </el-table-column>
      <el-table-column
          prop="age"
          label="年龄">
      </el-table-column>
      <el-table-column
          prop="realname"
          label="真实姓名">
      </el-table-column>
      <el-table-column
          prop="phone"
          label="电话">
      </el-table-column>
      <el-table-column
          label="操作">
        <template slot-scope="scope">
          <el-button type="primary">修改</el-button>
          <el-button type="danger" @click="deleteUser(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import {adminAll,delByUserName} from '../../../network/admin';
export default {
  name: "memberMyself",
  created() {
    console.log(this.$store.state.username)
    adminAll().then((result)=>{
      console.log(result);
      this.tableData=result.data.data;
    }).catch((reason)=>{
      console.log(reason);
    })
  },
  data() {
    return {
      tableData: []
    }
  },
  methods:{
    deleteUser(data){
      delByUserName(data.username).then((result)=>{
        console.log(result);
        adminAll().then((result)=>{
          console.log(result);
          this.tableData=result.data.data;
        }).catch((reason)=>{
          console.log(reason);
        })
      }).catch((reason)=>{
        console.log(reason);
      })
      // console.log(data)
    }
  }
}
</script>

<style scoped>

</style>
